package com.smart.fourteen.hibernate.cfg;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestCfg {
    public static void main(String[] args) {
        Configuration cfg = new Configuration().configure("com/smart/fourteen/hibernate/cfg/hibernate.cfg.xml");
        SessionFactory sessionFactory = cfg.buildSessionFactory();
        System.out.println(sessionFactory);

        ApplicationContext ac = new ClassPathXmlApplicationContext("com/smart/fourteen/hibernate/cfg/applicationContext-hibernate.xml");
        SessionFactory f = (SessionFactory)ac.getBean("sessionFactory");
        System.out.println(f);
    }
}
